﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Web;
using VonaJobs.DAL.DAO;

namespace VonaJobs.DAL.Gatway
{
    public class BusinessTypeGateway:DBGateway
    {
        public string SaveBusinessType(BusinessType businessType)
        {
            try
            {
                ConnectionObj.Open();
                CommandObj.CommandText = string.Format("insert into tblBusinessType values(@TypeName,@Description)");
                CommandObj.Parameters.Clear();
                CommandObj.Parameters.Add("@TypeName", SqlDbType.VarChar).Value = businessType.TypeName;
                CommandObj.Parameters.Add("@Description", SqlDbType.VarChar).Value = businessType.Description;
                
                CommandObj.ExecuteNonQuery();
                return "New Business type save successfully";
            }
            catch (Exception)
            {
                throw new Exception("Message Not Send, Server Error !");
            }
            finally
            {
                if (ConnectionObj != null && ConnectionObj.State == ConnectionState.Open)
                {
                    ConnectionObj.Close();
                }

            }
        }
    }
}